#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable:6031)
#include<stdio.h>

void InSertSort(int* arr, int size)
{
	for (int i = 0; i < size-1; i++)
	{
		int end = i;
		int tmp = arr[end + 1];
		while (end >= 0)
		{
			if (arr[end] > tmp)
			{
				arr[end + 1] = arr[end];
				end--;
			}
			else
				break;
		}	
		arr[end + 1] = tmp;
	}
}
int main()
{
	int arr[] = { 1,2,6,5,8,1};
	int size = sizeof(arr) / sizeof(int);
	InSertSort(arr, size);
	for (int i = 0; i < size; i++)
	{
		printf("%d ", arr[i]);
	}
	return 0;
}